Return to doc.sitecore.com

Valid for Sitecore 5.3
  Path fields in media items are not updated

The "path" fields in media items are not updated when the media items are moved/renamed.

The solution:

  1. Compile the code available in the UpdatePathInMediaItem.zip file and copy the resulting UpdatePathInMediaItem.dll assembly to the /bin/ folder.
     
  2. Add this custom event handler in web.config:
    <event name="item:moved">
       <handler type="UpdatePathInMediaItem.MediaItemHandler, UpdatePathInMediaItem" method="OnItemMoved" />
    </event>

    <event name="item:renamed" >
       <handler type="UpdatePathInMediaItem.MediaItemHandler, UpdatePathInMediaItem" method="OnItemRenamed" />
    </event>

Download UpdatePathInMediaItem.zip (1 Kb) 

To update all the items that have been moved/renamed before using the solution above, please use the code available in the AutoUpdatePathInMediaItem.zip (1 Kb).